<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<%--角色对应wwkm --%>
		<base href="<%=basePath%>">
		<title>${title}</title>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>    
		<link rel="stylesheet" type="text/css" href="resource/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="<c:url value='/resource/css/zTreeStyle/zTreeStyle.css'/>"></link>
		<script type="text/javascript" src="<c:url value='/resource/js/jquery-1.7.2.min.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/js/jquery.ztree.core-3.2.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/js/tree_read.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/js/view/role_users.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/js/common.js'/>"></script>
		<script type="text/javascript">
			function saveRoleUsersData(){
				var ids = new Array();
				$("#unselected_roles").find("option").each(function(index,user){
					ids.push($(this).val());
				});
				$.ajax({
					url:"<%=path%>/sys/role/relation/${roleId}.json",
					data:{userid:ids.join()},
					success:function(data){
						parent.showMessage(data.msg.body);
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);

					},
					error:function(){
						parent.showMessage(data.msg.body);
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					}
					
				});
			}
		</script>
	</head>
	<body >
   		<div style="height:400px;margin-top: 10px">
   			<div id="left_div" style="width:310px;">
				<div style="text-align:center;width:310px;font-weight:bold;height:20px;">已选人员</div>
   				<select id="unselected_roles" multiple="multiple" style="width:310px">
   					<c:forEach var="u" items="${users}">
   					<option value="${u.policeNum}" title="${u.name}【${u.deptName}】">${u.name}【${u.deptName}】</option>
   					</c:forEach>
   				</select>
   			</div>
			<div style="width:30px;" id="middle_div">
				<p style="width:30px" id="p_remove_selected" title="添加已选中人员至当前角色">&lt;</p>
				<p style="width:30px" id="p_remove_all" title="添加所有人员至当前角色">&lt;&lt;</p>
				<p style="width:30px" id="p_add_selected" title="从当前角色中移除已选中人员">&gt;</p>
				<p style="width:30px" id="p_sel_all" title="移除当前角色下所有人员">&gt;&gt;</p>
			</div>
			<div id="right_div">
				<div style="text-align:center;font-weight:bold;height:20px;color:green">部门人员</div>
				<input id="id_rolesIdStr" type="hidden" name="rolesIdStr"/>
				<input id="id_roleNameStr" type="hidden" name="rolesNameStr"/>
   				<select id="selected_roles" multiple="multiple">
   					<c:forEach var="role" items="${allroles}">
   					<option value="${role.rcode}">${role.rname}</option>
   					</c:forEach>
   				</select>
			</div>
   			<div id="tree_div" style="width:200px;height:400px;float:left;margin-left:10px;">
   				<div style="text-align:center;width:190px;font-weight:bold;height:20px;">系统组织机构树</div>
	    		<div id="tree_wrap_div" style="float:left;overflow-x:hidden;overflow-y:auto;height:370px;width:200px;">
					<ul id="treeDemo" class="ztree" style="width:190px;overflow-x:hidden;"></ul>
				</div>
	    	</div>
		</div>
	</body>
</html>
